<template>
  <common-manage
    :cp="'teacher'"
    :tableData="tableData"
    :table="table"
    :formTemplate="formTemplate"
    :fileUrl="'http://192.168.1.125:14000/webhdfs/v1/file/20230609083928/sample-teacher.xlsx?op=OPEN&user.name=root'"
    :uploadUrl="`http://192.168.1.125:8080/home/home/analysis/teachers`"
  ></common-manage>
</template>

<script>
import CommonManage from "@/components/CommonManage.vue";
import { getTeachers } from "@/services/admin/teacher";
export default {
  name: "TeacherManage",
  components: { CommonManage },
  data() {
    return {
      tableData: [],
      table: [
        {
          label: "账号",
          prop: "teacher_id",
        },
        {
          label: "姓名",
          prop: "name",
        },
        {
          label: "密码",
          prop: "password",
        },
        {
          label: "性别",
          prop: "gender",
        },
        {
          label: "任职开始时间",
          prop: "appoint_start",
        },
        {
          label: "任职结束时间",
          prop: "appoint_end",
        },
      ],
      formTemplate: [
        {
          type: "input",
          label: "账号",
          key: "teacher_id",
          disabled: true,
        },
        {
          type: "input",
          label: "密码",
          key: "password",
        },
        {
          type: "input",
          label: "姓名",
          key: "name",
        },
        {
          type: "radio",
          label: "性别",
          opts: ["男", "女"],
          key: "gender",
        },
        {
          type: "date_picker",
          label: "任职开始时间",
          key: "appoint_start",
        },
        {
          type: "date_picker",
          label: "任职结束时间",
          key: "appoint_end",
        },
      ],
    };
  },
  created() {
    // 获取教员数据
    getTeachers().then((res) => {
      this.tableData = res.data.data.teachers || [];
    });
  },
};
</script>

<style>
</style>